const Monitor = require('../../utils/monitor.js').Monitor
const utils = require('../../utils/util.js')

Page(Monitor.hookApp({
  data: {
    date:'2018/04/01-2019/04/01'
  },
  require(card_id) { //获取卡下面的页面信息
    utils.API('spwx/v1.Vipcard/details', {
      card_id: card_id,
    }).then(res => {
      let {
        code,
        msg,
        data
      } = res
      if (code === 200) {
        this.setData({
          data: data
        })
      }
    })
  },
  jump(e){
    console.log(e)
    if (e.currentTarget.dataset.is_buy=='true'){
      wx.navigateTo({
        url: '../Commodity/Commodity',
      })
    }else{
      wx.navigateTo({
        url: '../ChongZhi/ChongZhi',
      })
    }
  },
  onLoad: function (options) {
    this.require(options.card_id)
  }
}))